import sys
from PySide6.QtWidgets import QApplication, QMainWindow,QFileDialog
from Ui_MainWinMenuToolbar_demo import Ui_MainWindow
import os

class MainWindow(QMainWindow,Ui_MainWindow):
    def __init__(self,parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self.fileCloseAction.triggered.connect(self.close)
        self.fileOpenAction.triggered.connect(self.openFile)
        self.openCalc.triggered.connect(lambda :os.system('calc'))
        self.openNotepad.triggered.connect(lambda :os.system('notepad'))
    def openFile(self):
        fileName, ok = QFileDialog.getOpenFileName(self, "打开", "C:/", "All Files (*);;Text Files (*.txt)")
        self.statusbar.showMessage(fileName) 
if __name__ == '__main__':
    app = QApplication(sys.argv)
    main_window = MainWindow()
    main_window.show()
    sys.exit(app.exec())